
using log4net.Config;
using Microsoft.Extensions.DependencyInjection;

namespace BasicConfigurationWebApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);
            // Add services to the container.

            builder.Services.AddControllers();
            {
                IConfiguration config = builder.Configuration;
                ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
                configurationBuilder.AddJsonFile("appsettings.json", true, true);
                IConfiguration buil = configurationBuilder.Build();
                //verification xx = new verification();
                //buil.GetSection("verification").Bind(xx);
                //builder.Services.AddSingleton(xx);

                builder.Services.Configure<verification>(buil.GetSection("verification"));
            }
            //builder.Services.AddLogging(x => { x.addcoon});
            //XmlConfigurator.Configure(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4Net.config")));
            //builder.Logging.ClearProviders();
            builder.Logging.AddLog4Net("log4Net.config");
            // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
            builder.Services.AddEndpointsApiExplorer();

            builder.Services.AddSwaggerGen();

            var app = builder.Build();

            var xx = app.Environment.EnvironmentName;

            // Configure the HTTP request pipeline.
            if (app.Environment.IsDevelopment())
            {
                app.UseSwagger();
                app.UseSwaggerUI();
            }

            app.UseAuthorization();


            app.MapControllers();

            app.Run();
        }
    }
}
